#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#include <list>

using namespace std;

class Solution {
public:
    vector<int> goodDaysToRobBank(vector<int>& security, int time) {
        vector<int> ret{};
        int len = security.size();
        vector<int> left(len, 0);
        vector<int> right(len, 0);

        for (int idx = 1; idx < len; idx++) {
            if (security[idx] <= security[idx - 1]) {
                left[idx] = left[idx - 1] + 1;
            }

            if (security[len - idx - 1] <= security[len - idx]) {
                right[len - idx - 1] = right[len - idx] + 1;
            }
        }

        for (int idx = 0; idx < len; idx++) {
            if (left[idx] >= time && right[idx] >= time) {
                ret.push_back(idx);
            }
        }
        return ret;
    }
};

int main()
{
    Solution s;
    vector<int> vt{5,3,3,3,5,6,2};
    vector<int> ret = s.goodDaysToRobBank(vt, 2);
    for (const auto& num : ret) {
        cout << num << " ";
    }
    cout << endl;

    // if (is_sorted(vt.begin() + 3, vt.begin() + 6)) {
    //     cout << "OK " << endl;
    // }

    // bool flag = true;
    // // 判断前半部分是否是非递增
    // for (int left = idx - time + 1; left < idx; left++) {
    //     if (security[left] > security[left - 1]) {
    //         flag = false;
    //         break;
    //     }
    // }
    // // 判断后半部分是否为非递减
    // for (int right = idx + 1; flag && right < idx + time; right++) {

    // }
    return 0;
}